#include "../GlobalGameData.h"
#include "DObject.h"
#include "DCell.h"

using namespace DeepClasses;

DeepClasses::DObject::DObject(DString name, wchar_t code, short color) 
{
	m_color=color;
	m_code=code;
	m_name=name;
	m_mainMat=NULL;
	m_cached=false;
}

DeepClasses::DObject::~DObject()
{

}

void DeepClasses::DObject::SetCachedFlag()
{
	m_cached=true;
}

bool DeepClasses::DObject::IsCached()
{
	return m_cached;
}

int DeepClasses::DObject::Move( TLocation newLoc )
{
	//DCell* currCell = gameData.m_world->m_map.GetCellAt(m_pos);


	return DE_OK;
}

int DeepClasses::DObject::Place( TLocation newLoc )
{
	return DE_OK;
}

int DeepClasses::DObject::Tick()
{
	DCell* cur = gameData.m_world->m_map.GetCellAt(m_pos);
	if(cur->m_floorMat==NULL)
	{
		TLocation b = m_pos.Below();
		if(b.m_z>=0)
		{
			DCell* below = gameData.m_world->m_map.GetCellAt(b);
			if(below->m_fillMat==NULL)
			{
				Move(b);
			}
		}
		
	}
	return DE_OK;
}

int DeepClasses::DObject::Remove()
{
	return DE_OK;
}


